<script>
const arr=[1,6,35,212,32];
const sum=arr.reduce(function(sum,n,index){
    console.group(`index=${index}`)
    console.log(`sum=${sum},n=${n}`)
    const nextSum=sum+n
    console.log(`nextSum=${nextSum}`)
    console.groupEnd()
    return nextSum

},0)
console.log(`sum=${sum}`);

const arr2=[1,2,3]
const newArr=[];
arr2.forEach(function(n){
    newArr.push(n*2)
})
console.log(newArr);

const res=arr2.map(function(n){
    return n*2
})

</script>